package webgamemaker.RPGMakerVXLoader;

import java.util.ArrayList;

import webgamemaker.Common.AutoTile;
import webgamemaker.Common.Callback;
import webgamemaker.Common.Tile;
import webgamemaker.Common.TileData;
import webgamemaker.Common.TileSet;


public class TileSetA2 extends TileSet {

	public TileSetA2(String filename) {
		super(filename, 32, 32);
		addLoadCallback(new LoadCallback());
	}
	
	public class LoadCallback implements Callback
	{
		public void onCall(Object src) 
		{
			ArrayList<TileData> tiles = new ArrayList<TileData>();
			for(int i = 0; i < 32; i++)
			{
				Tile tab[] = new Tile[6];
				for(int j = 0; j < 6; j++)
					tab[j] = TileSetA2.this.tiles.get((j%2)+(j/2)*16+(i%8)*2+(i/8)*48).tile;
				tiles.add(new TileData(new AutoTile(tab)));
			}
			TileSetA2.this.tiles = tiles;
		}
	}

}
